package org.beetl.sql.ext.jpa.mapper.internal.jpa;

import java.lang.reflect.Method;

import org.beetl.sql.clazz.kit.BeetlSQLException;
import org.beetl.sql.core.SQLManager;
import org.beetl.sql.mapper.MapperInvoke;

public class DeleteAllByIdInBatchAMI extends MapperInvoke{

	@Override
	public Object call(SQLManager sm, Class entityClass, Method m, Object[] args) {
		if(!(args[0] instanceof Iterable)){
            throw new BeetlSQLException(BeetlSQLException.MAPPING_ERROR,"期望第一个参数是Iterable");
        }
		Iterable ids = (Iterable)args[0];
		ids.forEach(o->{
			sm.deleteById(entityClass, o);
		});
		return null;
	}


}
